﻿#region << 版 本 注 释 >>
/*----------------------------------------------------------------
 * 版权所有 (c) 2022   保留所有权利。
 * CLR版本：4.0.30319.42000
 * 机器名称：DESKTOP-UL84BU5
 * 公司名称：
 * 命名空间：KingerRobot.WanliWMS.Spi
 * 唯一标识：c22506ad-0039-4ea3-aa79-f89867846ee3
 * 文件名：IMaterialManage
 * 当前用户域：DESKTOP-UL84BU5
 * 
 * 创建者：zzl
 * 电子邮箱：1003590782@qq.com
 * 创建时间：2022/7/4 10:44:13
 * 版本：V1.0.0
 * 描述：
 *
 * ----------------------------------------------------------------
 * 修改人：
 * 时间：
 * 修改说明：
 *
 * 版本：V1.0.1
 *----------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace KingerRobot.MexicoSailunWMS.Spi;

public interface ILocationManageService
{
    /// <summary>
    /// 库位查询
    /// </summary>
    /// <param name="locationPara"></param>
    /// <returns></returns>
    List<LocationBean> GetLocations(LocationPara locationPara);

    /// <summary>
    /// 库存查询
    /// </summary>
    /// <param name="locationPara"></param>
    /// <returns></returns>
    List<HasLocationBean> GetHasLocationsOld(HasLocationPara locationPara);

    List<HasLocationBean> GetHasLocations(HasLocationPara locationPara);
    /// <summary>
    /// 物料统计
    /// </summary>
    /// <param name="locationPara"></param>
    /// <returns></returns>
    List<LocationMaterialBean> GetLocationsMaterial(LocationMaterialPara locationMaterialPara);
    /// <summary>
    /// 库存无物料
    /// </summary>
    /// <param name="locationPara"></param>
    /// <returns></returns>
    List<HasLocationBean> GetLocationsNoMaterial(LocationNoMaterialPara locationNoMaterialPara);


    /// <summary>
    /// 库存超期
    /// </summary>
    /// <param name="locationPara"></param>
    /// <returns></returns>
    List<HasLocationBean> GetTimeOutLocations(HasLocationPara locationPara);
    /// <summary>
    /// 删除物料
    /// </summary>
    /// <param name="id"></param>
    /// <returns>
    /// 0:失败
    /// 1:成功
    /// -1:货位有出库任务，无法删除
    /// -2:货位有入库任务，无法删除
    /// </returns>
    int DeleteMaterialLocation(long id, long userId, string userName, string clientHost);
    /// <summary>
    /// 添加物料
    /// </summary>
    /// <param name="barCode"></param>
    /// <returns>
    /// 0:失败
    /// 1:成功
    /// -1:未找到产品条码信息
    /// </returns>
    int AddMaterialLocation(BuildingLocation buildingLocation, long userId, string userName, string clientHost);
    /// <summary>
    /// 修改库位可用性
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    int UpdateLocEnable(long id);
    /// <summary>
    /// 修改库位的可用性，含有禁用信息
    /// </summary>
    /// <param name="param"></param>
    /// <returns></returns>
    int ChangeLocEnable(LocEnableParam param, long userId, string userName, string clientHost);
    /// <summary>
    /// 修改入库可用性
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    int UpdateInEnable(long id, long userId, string userName, string clientHost);
    /// <summary>
    /// 修改出库可用性
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    int UpdateOutEnable(long id, long userId, string userName, string clientHost);
    /// <summary>
    /// 库位异常
    /// </summary>
    /// <param name="locationPara"></param>
    /// <returns></returns>
    List<LocationBean> GetErrLocations(LocationPara locationPara);


    /// <summary>
    /// 立库库位设置
    /// </summary>
    /// <param name="locationPara"></param>
    /// <returns></returns>
    List<LocationBean> SetLocations(LocationPara locationPara);
    /// <summary>
    /// 修改坐标
    /// </summary>
    /// <param name="coordPara"></param>
    /// <returns></returns>
    int UpdateLocCoord(CoordPara coordPara);
    /// <summary>
    /// 货位名称下拉框
    /// </summary>
    /// <returns></returns>
    List<LocNameBean> GetLocNameBean();
    /// <summary>
    /// 获取每台堆垛机的剩余可用货位
    /// </summary>
    /// <returns></returns>
    List<CrnEnableLocationBean> GetCrnEnableLocation();
    /// <summary>
    /// 获取库区库存配对胎
    /// </summary>
    public List<StockPairBean> GetStockPair();
}
public class StockPairBean
{
    public string WarehouseName { get; set; }
    public int PairNum { get; set; }
    public int AllNum { get; set; }
    public double AllNumPercentage { get; set; }

}
public class CrnEnableLocationBean
{
    public long CrnId { get; set; }
    public string CrnName { get; set; }

    public int ShortLocationCount { get; set; }

    public int UnableLocationCount { get; set; }
}
public class LocNameBean
{
    public long Id;
    /// <summary>
    /// 货位名称
    /// </summary>
    public string LocName { get; set; }

}

public class CoordPara
{
    public long Id;
    public int X;
    public int Z;
    public int T;
    public int axisX;
    public int axisZ;
    public int axisT;
}


public class LocationMaterialPara
{
    /// <summary>
    /// 仓库ID
    /// </summary>
    public long? WarehouseId { get; set; }
    /// <summary>
    /// 物料Spec码
    /// </summary>
    public string Spec { get; set; }
    /// <summary>
    /// 物料代码
    /// </summary>
    public string MaterialCode { get; set; }
    /// <summary>
    /// 物料名称
    /// </summary>
    public string MaterialName { get; set; }
    /// <summary>
    /// 堆垛机ID
    /// </summary>
    public string EquipId { get; set; }
    /// <summary>
    /// 堆垛机名称
    /// </summary>
    public string CrnName { get; set; }
}

public class LocationMaterialBean
{
    /// <summary>
    /// 物料Spec码
    /// </summary>
    public string Spec { get; set; }
    /// <summary>
    /// 物料代码
    /// </summary>
    public string MaterialCode { get; set; }
    /// <summary>
    /// 物料名称
    /// </summary>
    public string MaterialName { get; set; }
    /// <summary>
    /// 仓库名称
    /// </summary>
    public string WarehouseName { get; set; }
    /// <summary>
    /// 物料数量
    /// </summary>
    public int MaterialCount { get; set; }
}

public class BuildingLocation
{
    /// <summary>
    /// 产品条码
    /// </summary>
    public string BarCode { get; set; }
    /// <summary>
    /// 位置
    /// </summary>
    public string LocId { get; set; }
}

public class LocationPara
{
    /// <summary>
    /// 货位编号
    /// </summary>
    public string Code { get; set; }
    /// <summary>
    /// 货位名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 是否可用【1:可用；0：不可用】
    /// </summary>
    public int? LocEnable { get; set; }
    /// <summary>
    /// 入库可用【1:可用；0：不可用】
    /// </summary>
    public int? InEnable { get; set; }
    /// <summary>
    /// 入库有货异常【是/否】【1:是；0：否】
    /// </summary>
    public int? ErrInHas { get; set; }
    /// <summary>
    /// 出库可用【1:可用；0：不可用】
    /// </summary>
    public int? OutEnable { get; set; }
    /// <summary>
    /// 出库空异常【是/否】【1:是；0：否】
    /// </summary>
    public int? ErrOutEmpty { get; set; }
    /// <summary>
    /// 仓库id
    /// </summary>
    public long? WarehouseId { get; set; }

    public string EquipName { get; set; }
    public string locationType { get; set; }
}

public class LocationNoMaterialPara
{
    /// <summary>
    /// 货位名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 是否可用【1:可用；0：不可用】
    /// </summary>
    public int? LocEnable { get; set; }
    /// <summary>
    /// 入库可用【1:可用；0：不可用】
    /// </summary>
    public int? InEnable { get; set; }
    /// <summary>
    /// 出库可用【1:可用；0：不可用】
    /// </summary>
    public int? OutEnable { get; set; }
}
public class HasLocationPara
{
    /// <summary>
    /// 货位名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 堆垛机名称
    /// </summary>
    public string CrnName { get; set; }
    /// <summary>
    /// 货位编号
    /// </summary>
    public string Code { get; set; }
    /// <summary>
    /// 产品条码
    /// </summary>
    public string ProductCode { get; set; }

    /// <summary>
    /// 堆垛机编码 Id
    /// </summary>
    public string StockerCode { get; set; }
    /// <summary>
    /// 物料Spec码
    /// </summary>
    public string Spec { get; set; }
    public string Status { get; set; }
    /// <summary>
    /// 物料规格
    /// </summary>
    public string MaterialCode { get; set; }
    /// <summary>
    /// 是否可用【1:可用；0：不可用】
    /// </summary>
    public int? LocEnable { get; set; }
    /// <summary>
    /// 入库可用【1:可用；0：不可用】
    /// </summary>
    public int? InEnable { get; set; }
    /// <summary>
    /// 出库可用【1:可用；0：不可用】
    /// </summary>
    public int? OutEnable { get; set; }

    /// <summary>
    /// 是否冻结 【1 冻结 0 未冻结】
    /// </summary>
    public int? Frozen { get; set; }
    /// <summary>
    /// 仓库id
    /// </summary>
    public long? WarehouseId { get; set; }


    public string? IsTimeOut { get; set; }

    public string orderByName { get; set; }
    public string orderByType { get; set; }

    public int? IsOut { get; set; }

}

public class LocationBean
{
    public long Id { get; set; }
    /// <summary>
    /// 货位编号
    /// </summary>
    public string Code { get; set; }
    /// <summary>
    /// 货位名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 仓库名称
    /// </summary>
    public string WarehouseName { get; set; }
    /// <summary>
    /// 坐标轴X
    /// </summary>
    public int nX { get; set; }
    public int X { get; set; }
    /// <summary>
    /// 坐标轴Y
    /// </summary>
    public int nY { get; set; }
    public int Y { get; set; }
    /// <summary>
    /// 坐标轴Z
    /// </summary>
    public int nZ { get; set; }
    public int Z { get; set; }
    /// <summary>
    /// 坐标轴T
    /// </summary>
    public int nT { get; set; }
    public int T { get; set; }
    /// <summary>
    /// 是否有货
    /// </summary>
    public string LocHasSku { get; set; }
    /// <summary>
    /// 有货时间
    /// </summary>
    public DateTime? LocHasSkuTime { get; set; }
    /// <summary>
    /// 是否可用
    /// </summary>
    public string LocEnable { get; set; }
    /// <summary>
    /// 是否可用
    /// </summary>
    public bool IsLocEnable { get; set; }
    /// <summary>
    /// 入库可用
    /// </summary>
    public string InEnable { get; set; }
    /// <summary>
    /// 入库是否可用
    /// </summary>
    public bool IsInEnable { get; set; }
    /// <summary>
    /// 入库有货异常【是/否】
    /// </summary>
    public string ErrInHas { get; set; }

    /// <summary>
    /// 出库可用
    /// </summary>
    public string OutEnable { get; set; }

    /// <summary>
    /// 出库是否可用
    /// </summary>
    public bool IsOutEnable { get; set; }
    /// <summary>
    /// 出库空异常【是/否】
    /// </summary>
    public string ErrOutEmpty { get; set; }
    /// <summary>
    /// 优先级
    /// </summary>
    public int RelateScore { get; set; }
    /// <summary>
    /// 物料 Spec 码
    /// </summary>
    public string Spec { get; set; }
    /// <summary>
    /// 库位类型
    /// </summary>
    public int LocType { get; set; }

    /// <summary>
    /// 备注，禁用原因
    /// </summary>
    public string Remarks { get; set; }

    /// <summary>
    /// 是否待出库 ： 0 否； 1 是
    /// </summary>
    public int IsOut { get; set; }
    /// <summary>
    /// 是否待出库
    /// </summay>
    public string OutName { get; set; }
    /// <summary>
    /// 流水号
    /// </summary>
    public int TaskNo { get; set; }
    public string EquipName { get; set; }
}


public class LocationBeanV2
{
    public long Id { get; set; }
    /// <summary>
    /// 货位编号
    /// </summary>
    public string Code { get; set; }
    /// <summary>
    /// 货位名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 仓库名称
    /// </summary>
    public string WarehouseName { get; set; }
    /// <summary>
    /// 坐标轴X
    /// </summary>
    public int nX { get; set; }
    public int X { get; set; }
    /// <summary>
    /// 坐标轴Y
    /// </summary>
    public int nY { get; set; }
    public int Y { get; set; }
    /// <summary>
    /// 坐标轴Z
    /// </summary>
    public int nZ { get; set; }
    public int Z { get; set; }
    /// <summary>
    /// 坐标轴T
    /// </summary>
    public int nT { get; set; }
    public int T { get; set; }
    /// <summary>
    /// 是否有货
    /// </summary>
    public int LocHasSku { get; set; }
    /// <summary>
    /// 有货时间
    /// </summary>
    public DateTime? LocHasSkuTime { get; set; }
    /// <summary>
    /// 是否可用
    /// </summary>
    public int LocEnable { get; set; }
    /// <summary>
    /// 是否可用
    /// </summary>
    public bool IsLocEnable { get; set; }
    /// <summary>
    /// 入库可用
    /// </summary>
    public int InEnable { get; set; }
    /// <summary>
    /// 入库是否可用
    /// </summary>
    public bool IsInEnable { get; set; }
    /// <summary>
    /// 入库有货异常【是/否】
    /// </summary>
    public int ErrInHas { get; set; }

    /// <summary>
    /// 出库可用
    /// </summary>
    public int OutEnable { get; set; }

    /// <summary>
    /// 出库是否可用
    /// </summary>
    public bool IsOutEnable { get; set; }
    /// <summary>
    /// 出库空异常【是/否】
    /// </summary>
    public int ErrOutEmpty { get; set; }
    /// <summary>
    /// 优先级
    /// </summary>
    public int RelateScore { get; set; }
    /// <summary>
    /// 物料 Spec 码
    /// </summary>
    public string Spec { get; set; }
    /// <summary>
    /// 库位类型
    /// </summary>
    public int LocType { get; set; }

    /// <summary>
    /// 备注，禁用原因
    /// </summary>
    public string Remarks { get; set; }

    /// <summary>
    /// 是否待出库 ： 0 否； 1 是
    /// </summary>
    public int IsOut { get; set; }
    /// <summary>
    /// 是否待出库
    /// </summay>
    public string OutName { get; set; }
    /// <summary>
    /// 流水号
    /// </summary>
    public int TaskNo { get; set; }
    public string EquipName { get; set; }

    public long? WarehouseId { get; set; }
}
public class HasLocationBean
{
    public long Id { get; set; }
    /// <summary>
    /// 货位编号
    /// </summary>
    public string Code { get; set; }
    /// <summary>
    /// 产品条码
    /// </summary>
    public string ProductCode { get; set; }
    /// <summary>
    /// 货位名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 仓库名称
    /// </summary>
    public string WarehouseName { get; set; }

    /// <summary>
    /// 仓库id
    /// </summary>
    public long WarehouseId { get; set; }
    /// <summary>
    /// 有货时间
    /// </summary>
    public DateTime? LocHasSkuTime { get; set; }
    /// <summary>
    /// 生产时间
    /// </summary>
    public DateTime? MdTime { get; set; }
    /// <summary>
    /// 超期时间
    /// </summary>
    public DateTime? OutTime { get; set; }
    /// <summary>
    /// 物料 Spec 码
    /// </summary>
    public string Spec { get; set; }
    /// <summary>
    /// 物料代码
    /// </summary>
    public string MaterialCode { get; set; }
    /// <summary>
    /// 物料名称
    /// </summary>
    public string MaterialName { get; set; }
    /// <summary>
    /// 是否可用
    /// </summary>
    public string LocEnable { get; set; }
    /// <summary>
    /// 入库可用
    /// </summary>
    public string InEnable { get; set; }
    /// <summary>
    /// 出库可用
    /// </summary>
    public string OutEnable { get; set; }
    /// <summary>
    /// 胎胚质量【0，1】
    /// </summary>
    public string GtStatus { get; set; }
    /// <summary>
    /// 胎胚质量【0:合格；1：不合格】
    /// </summary>
    public string GtStatusName { get; set; }
    /// <summary>
    /// 所属成型机
    /// </summary>
    public string TbmNo { get; set; }
    /// <summary>
    /// 所属堆垛机
    /// </summary>
    public string EquipName { get; set; }

    /// <summary>
    /// 所属堆垛机编码 Id
    /// </summary>
    public long? EquipCode { get; set; }

    /// <summary>
    /// 胎胚锁定  0:解锁 1:锁定
    /// </summary>
    public int? FrozenNum { get; set; }
    /// <summary>
    /// 胎胚锁定  0:解锁 1:锁定
    /// </summary>
    public string FrozenStr { get; set; }
    /// <summary>
    /// 是否待出库 ： 0 否； 1 是
    /// </summary>
    public int IsOut { get; set; }
    /// <summary>
    /// 是否待出库
    /// </summay>
    public string OutName { get; set; }
    /// <summary>
    /// 流水号
    /// </summary>
    public int TaskNo { get; set; }
    public string CuringCode { get; set; }

    public string IsTimeOut { get; set; }
}

public class LocEnableParam
{
    /// <summary>
    /// 库位Id
    /// </summary>
    public long? Id { get; set; }

    /// <summary>
    /// 备注 —— 禁用原因
    /// </summary>

    public string Remarks { get; set; }
}